package cn.tedu.vrd01test.mapper;

import cn.tedu.vrd01test.entity.User;
import cn.tedu.vrd01test.entity.Works;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface WorksMapper {
    @Select("select id,title,type,style,ip,author,created,likeCount,imgurl,iconurl,description from works")
    List<Works> selectAll();

    @Select("select id,title,type,style,ip,author,created,likeCount,imgurl,iconurl,description from works order by likeCount desc limit 0,8")
    List<Works> selectViewList();

    @Select("select id,title,type,style,ip,author,created,likeCount,imgurl,iconurl,description from works order by created desc limit 0,24")
    List<Works> selectNewList();

    @Select("select id,name,password,role,follow,fans,score,workCount,headurl,introl from user limit 0,4")
    List<User> selectUserList();

    @Select("select id,title,type,style,ip,author,created,likeCount,imgurl,iconurl,description from works where id=#{id}")
    Works selectById(int id);

    @Select("select id,title,type,style,ip,author,created,likeCount,imgurl,iconurl,description from works where authoe=#{author}")
    Works selectByName(String author);
}
